package com.chapter.sample.juc.cas;

import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;

public class cas {
    public static void main(String[] args) {
        AtomicInteger atomicInteger = new AtomicInteger(5);
        System.out.println(atomicInteger.get());
//        atomicInteger.getAndIncrement()

        System.out.println(atomicInteger.compareAndSet(5, 1000) + " : " + atomicInteger.get());
        System.out.println(atomicInteger.compareAndSet(5, 1024) + " : " + atomicInteger.get());


    }
}
